/*
* Timer.java
* Copyright (C) 2005
* 
* $Id: Timer.java,v 1.2 2005/07/01 14:20:54 hzi Exp $
*/
using System;
using Globals = Suake2.UI.Globals;
using Com = Suake2.UI.qcommon.Com;
namespace Suake2.UI.sys
{
	
	
	public abstract class Timer
	{
		
		abstract public long currentTimeMillis();
		private static long time = 0;
		
		internal static Timer t;
		
		public static int Milliseconds()
		{
			return Globals.curtime = (int) (t.currentTimeMillis());
		}
		static Timer()
		{
			{
				try
				{
					t = new NanoTimer();
				}
				//UPGRADE_NOTE: Exception 'java.lang.Throwable' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
				catch (System.Exception e)
				{
					try
					{
						t = new HighPrecisionTimer();
					}
					//UPGRADE_NOTE: Exception 'java.lang.Throwable' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
					catch (System.Exception e1)
					{
						t = new StandardTimer();
					}
				}
				Com.Println("using " + t.GetType().FullName);
			}
		}
	}
}